using UnityEngine;
using UnityEngine.UI;
using QFramework;
using UnityEngine.SceneManagement;

namespace ProjectSurvivor
{
	public class UIGamePassPanelData : UIPanelData
	{
	}
	public partial class UIGamePassPanel : UIPanel
	{
		protected override void OnInit(IUIData uiData = null)
		{
			mData = uiData as UIGamePassPanelData ?? new UIGamePassPanelData();
			// please add init code here

			//游戏暂停
			Time.timeScale = 0;
			//注册
			// ActionKit.OnUpdate.Register(() =>
 			// {
			// 	 //点击空格
			// 	 if (Input.GetKeyDown(KeyCode.Space))
			// 	 {
			// 		 //重置数据
			// 		 Global.ResetData();
			// 		 //关闭面板
			// 		 this.CloseSelf();
			// 		 //再来一局
			// 		 SceneManager.LoadScene("Game");
			// 	 }
			//  }).UnRegisterWhenGameObjectDestroyed(gameObject);

			BtnBackToStart.onClick.AddListener(() =>
			{
				this.CloseSelf();
				SceneManager.LoadScene("GameStart");
			});
			AudioKit.PlaySound("GamePass");
		}

		protected override void OnOpen(IUIData uiData = null)
		{
		}

		protected override void OnShow()
		{
		}

		protected override void OnHide()
		{
		}

		protected override void OnClose()
		{
			Time.timeScale = 1;
		}
	}
}
